/*******************************************/
/* Φόρμα με το Κεντρικό Μενού Επιλογών  ****/
/* Αυτό εκτελείται πρώτο στο run ***********/
/*******************************************/
package radio_station7.gui;

import java.awt.Component;
import java.util.TimeZone;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;


public class Main extends javax.swing.JFrame {

    /**
     * Creates new form Main
     */
    public Main() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        desktopPane = new javax.swing.JDesktopPane();
        mainLabel = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        fileMenu = new javax.swing.JMenu();
        artistMenuItem = new javax.swing.JMenuItem();
        artistAlbumMenuItem = new javax.swing.JMenuItem();
        bandMenuItem = new javax.swing.JMenuItem();
        bandAlbumMenuItem = new javax.swing.JMenuItem();
        exitMenuItem = new javax.swing.JMenuItem();
        playlistMenu = new javax.swing.JMenu();
        aboutMenu = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        desktopPane.setLayout(null);

        mainLabel.setBackground(new java.awt.Color(0, 0, 0));
        mainLabel.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        mainLabel.setForeground(new java.awt.Color(255, 255, 255));
        mainLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/META-INF/Guitar.jpg"))); // NOI18N
        java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("radio_station7/gui/Bundle"); // NOI18N
        mainLabel.setText(bundle.getString("Main.mainLabel.text")); // NOI18N
        mainLabel.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED, new java.awt.Color(0, 102, 102), new java.awt.Color(0, 102, 204)));
        mainLabel.setOpaque(true);
        mainLabel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mainLabelMouseClicked(evt);
            }
        });
        desktopPane.add(mainLabel);
        mainLabel.setBounds(150, 190, 480, 170);

        menuBar.setToolTipText(bundle.getString("Main.menuBar.toolTipText")); // NOI18N
        menuBar.setName(""); // NOI18N

        fileMenu.setText(bundle.getString("Main.fileMenu.text")); // NOI18N

        artistMenuItem.setText(bundle.getString("Main.artistMenuItem.text")); // NOI18N
        artistMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                artistMenuItemActionPerformed(evt);
            }
        });
        fileMenu.add(artistMenuItem);

        artistAlbumMenuItem.setText(bundle.getString("Main.artistAlbumMenuItem.text")); // NOI18N
        artistAlbumMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                artistAlbumMenuItemActionPerformed(evt);
            }
        });
        fileMenu.add(artistAlbumMenuItem);

        bandMenuItem.setText(bundle.getString("Main.bandMenuItem.text")); // NOI18N
        bandMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bandMenuItemActionPerformed(evt);
            }
        });
        fileMenu.add(bandMenuItem);

        bandAlbumMenuItem.setText(bundle.getString("Main.bandAlbumMenuItem.text")); // NOI18N
        bandAlbumMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bandAlbumMenuItemActionPerformed(evt);
            }
        });
        fileMenu.add(bandAlbumMenuItem);

        exitMenuItem.setText(bundle.getString("Main.exitMenuItem.text")); // NOI18N
        exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitMenuItemActionPerformed(evt);
            }
        });
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        playlistMenu.setText(bundle.getString("Main.playlistMenu.text")); // NOI18N
        playlistMenu.addMenuListener(new javax.swing.event.MenuListener() {
            public void menuSelected(javax.swing.event.MenuEvent evt) {
                playlistMenuMenuSelected(evt);
            }
            public void menuDeselected(javax.swing.event.MenuEvent evt) {
            }
            public void menuCanceled(javax.swing.event.MenuEvent evt) {
            }
        });
        menuBar.add(playlistMenu);

        aboutMenu.setText(bundle.getString("Main.aboutMenu.text")); // NOI18N
        aboutMenu.addMenuListener(new javax.swing.event.MenuListener() {
            public void menuSelected(javax.swing.event.MenuEvent evt) {
                aboutMenuMenuSelected(evt);
            }
            public void menuDeselected(javax.swing.event.MenuEvent evt) {
            }
            public void menuCanceled(javax.swing.event.MenuEvent evt) {
            }
        });
        menuBar.add(aboutMenu);

        setJMenuBar(menuBar);
        menuBar.getAccessibleContext().setAccessibleDescription(bundle.getString("Main.menuBar.AccessibleContext.accessibleDescription")); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 850, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 700, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    // Επιλογή "Έξοδος" από το κυλιόμενο μενού
    private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
        System.exit(0);
    }//GEN-LAST:event_exitMenuItemActionPerformed
    // Επιλογή "Καλλιτέχνες" από το κυλιόμενο μενού
    private void artistMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_artistMenuItemActionPerformed
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                JInternalFrame internalFrame = createInternalFrameForPanel(new Artist());
                desktopPane.add(internalFrame);
                internalFrame.show();
            }
        });
    }//GEN-LAST:event_artistMenuItemActionPerformed
    // Επιλογή "Άλμπουμ Καλλιτεχνών" από το κυλιόμενο μενού "Αρχείο"
    private void artistAlbumMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_artistAlbumMenuItemActionPerformed
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                JInternalFrame internalFrame = createInternalFrameForPanel(new ArtistAlbum());
                desktopPane.add(internalFrame);
                internalFrame.show();
            }
        });
    }//GEN-LAST:event_artistAlbumMenuItemActionPerformed
    // Επιλογή "Συγκροτήματα" από το κυλιόμενο μενού "Αρχείο"
    private void bandMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bandMenuItemActionPerformed
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                JInternalFrame internalFrame = createInternalFrameForPanel(new Band());
                desktopPane.add(internalFrame);
                internalFrame.show();
            }
        });
    }//GEN-LAST:event_bandMenuItemActionPerformed
    // Επιλογή "Άλμπουμ Καλλιτεχνών" από το κυλιόμενο μενού "Αρχείο"
    private void bandAlbumMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bandAlbumMenuItemActionPerformed
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                JInternalFrame internalFrame = createInternalFrameForPanel(new BandAlbum());
                desktopPane.add(internalFrame);
                internalFrame.show();
            }
        });
    }//GEN-LAST:event_bandAlbumMenuItemActionPerformed
    // Ενέργειες για την επιλογή καρτέλας "Playlist" από το μενού
    private void playlistMenuMenuSelected(javax.swing.event.MenuEvent evt) {//GEN-FIRST:event_playlistMenuMenuSelected
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                JInternalFrame internalFrame = createInternalFrameForPanel(new Playlist());
                desktopPane.add(internalFrame);
                internalFrame.show();
            }
        });
        playlistMenu.setSelected(false);
    }//GEN-LAST:event_playlistMenuMenuSelected
    // Ενέργειες για την επιλογή καρτέλας "Περί..." από το μενού
    private void aboutMenuMenuSelected(javax.swing.event.MenuEvent evt) {//GEN-FIRST:event_aboutMenuMenuSelected
        java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("radio_station7/gui/Bundle"); // NOI18N
        JOptionPane.showMessageDialog(this, bundle.getString("Main.aboutMenu.message"));
        aboutMenu.setSelected(false);
    }//GEN-LAST:event_aboutMenuMenuSelected
    // Ενέργειες σε περίπτωση mouse click πάνω στην εικόνα του Radio Station 7 - Team 7
    private void mainLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mainLabelMouseClicked
        java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("radio_station7/gui/Bundle"); // NOI18N
        JOptionPane.showMessageDialog(this, bundle.getString("Main.aboutMenu.message"));
        aboutMenu.setSelected(false);
    }//GEN-LAST:event_mainLabelMouseClicked

    private JInternalFrame createInternalFrameForPanel(Component component) {
        JInternalFrame internalFrame = new JInternalFrame(null, true, true, false, false);

        internalFrame.add(component);
        internalFrame.pack();

        return internalFrame;
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Main().setVisible(true);
            }
        });

        TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu aboutMenu;
    private javax.swing.JMenuItem artistAlbumMenuItem;
    private javax.swing.JMenuItem artistMenuItem;
    private javax.swing.JMenuItem bandAlbumMenuItem;
    private javax.swing.JMenuItem bandMenuItem;
    private javax.swing.JDesktopPane desktopPane;
    private javax.swing.JMenuItem exitMenuItem;
    private javax.swing.JMenu fileMenu;
    private javax.swing.JLabel mainLabel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenu playlistMenu;
    // End of variables declaration//GEN-END:variables

}
